//Header file "definitions.hpp" declares many functions, constants, datatypes.
//In order to use the functions declared in definitions.hpp, must link
//with object code that includes functions.cpp.
#include "definitions.hpp"

int main (){

long long i,j,mcnum = 10;
long long mclen = 1000;//l;
double vdrop = 0.01;//(pow(vntrms_resid,2)-pow(vnttrms_resid,2))/pow(vntrms_resid,2);
double cvdrop=0;//Current variance drop, one for each MC test.
long long bigcnt=0,poscnt=0,negcnt=0;
const gsl_rng_type * R;
gsl_rng * r;
gsl_rng_env_setup();
R = gsl_rng_default;
r = gsl_rng_alloc(R);
gsl_rng_set(r,time(0));
//Loop through all Monte Carlo tests.
for(i=0;i<mcnum;i++){
  double cvar1=0.0,cvar2=0.0;//Current variance of noise and noise-tide model.
  //Create gaussian noise time series.
  for(j=0;j<mclen;j++){
    double randnum = gsl_ran_gaussian(r,1.0);
    cout<<"randnum: "<<randnum<<endl;
    cvar1 += pow(randnum,2);
    cvar2 += pow(randnum-0.666,2);
  }
  
  //Calculate variance after subtracting tide-only accels.


  cout<<"Run #"<<i+1<<" had variance drop of "<<cvdrop*100<<" %."<<endl;
  if(cvdrop>vdrop){
    bigcnt++;
  }
  else if(cvdrop>0.0){
    poscnt++;
  }
  else{
    negcnt++;
  }
}

cout<<"bigcnt: "<<bigcnt<<", poscnt: "<<poscnt<<", negcnt: "<<negcnt<<endl;

}
